home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / thor / thor_2.4 / checkver.rexx < prev    next >
OS/2 REXX Batch file  |  1996-11-11  |  1KB  |  63 lines

  1. /*
  2. ** $VER: checkver.rexx 1.1 (29.8.96)
  3. ** by Eirik Nicolai Synnes
  4. **
  5. ** Companion script for SortMail installation.  Should only be called if
  6. ** ENV:Thor/SortMail.cfg exists.
  7. **
  8. */
  9.  
  10. options results
  11.  
  12. found = 0
  13.  
  14. cfgopen = open(cfg, 'ENV:Thor/SortMail.cfg', 'R')
  15. if cfgopen then do until eof(cfg)
  16.     entry = readln(cfg)
  17.     select
  18.         when upper(subword(entry, 1, 1)) = "SYSTEM" then found = 1
  19.         when upper(subword(entry, 1, 1)) = "GLOBAL" then found = 2
  20.         otherwise nop
  21.         end
  22.     if found ~= 0 then break
  23.     end
  24. else exit(30)
  25.  
  26. call close(cfg)
  27.  
  28. if found = 2 then do
  29.     /* Find/open BBSREAD ARexx port */
  30.  
  31.     if ~show('P', 'BBSREAD') then do
  32.         address(command)
  33.         'Run >NIL: `GetEnv THOR/THORPath`bin/LoadBBSRead'
  34.         'SYS:RexxC/WaitForPort BBSREAD'
  35.         if rc ~= 0 then exit(30)
  36.         end
  37.  
  38.     address(bbsread)
  39.     'READARGS TEMPLATE "SYSTEM/K,CONFERENCE/A,STATISTICS/S,NOWARN/S,LOGINSTATE/S" STEM 'globalcfg' CMDLINE 'subword(entry, 2)
  40.     if rc ~= 0 then exit(rc)
  41.  
  42.     'GETBBSDATA "'globalcfg.SYSTEM'" 'bbsdata
  43.     if rc ~= 0 then exit(rc)
  44.  
  45.     bbsdata.BBSPATH = strip(bbsdata.BBSPATH, 'T', '/')
  46.  
  47.     if ~exists(bbsdata.BBSPATH) then exit(30)
  48.  
  49.     address command 'Copy ENV:Thor/SortMail.#? 'bbsdata.BBSPATH' QUIET CLONE'
  50.     if rc ~= 0 then exit(30)
  51.     address command 'Delete ENV:Thor/SortMail.#? ENVARC:Thor/SortMail.#? QUIET FORCE'
  52.     if rc ~= 0 then exit(30)
  53.  
  54.     envopen = open(env, 'ENV:SM_System', 'W')
  55.     if envopen then do
  56.         call writeln(env, bbsdata.BBSPATH)
  57.         call close(env)
  58.         end
  59.     else exit(30)
  60.     end
  61.  
  62. exit(found)
  63.